package com.wst.wst_server.controller;

import com.wst.wst_server.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    LoginService loginService;
    @RequestMapping("/login")
    public ResponseResult login(String username,String password){
        System.out.println("login...");
        return loginService.login(username,password);
    }
    @RequestMapping("/logout")
    public ResponseResult logout(String username,String password){
        SecurityContextHolder.getContext().setAuthentication(null);
        return new ResponseResult(200,"退出成功");
    }

}
